package cn.com.captureNetPacket.config;

import org.springframework.context.annotation.Bean;
import org.springframework.context.annotation.Configuration;
import org.springframework.web.context.request.async.DeferredResult;

import springfox.documentation.builders.ApiInfoBuilder;
import springfox.documentation.builders.RequestHandlerSelectors;
import springfox.documentation.service.ApiInfo;
import springfox.documentation.spi.DocumentationType;
import springfox.documentation.spring.web.plugins.Docket;
import springfox.documentation.swagger2.annotations.EnableSwagger2;

/**
 * Swagger相关配置类
 * @author WuPan
 * @date 2020-07-02
 *
 */
@Configuration
@EnableSwagger2
public class SwaggerConfig {
    @Bean
    public Docket sceneMgrDocket() {
        return new Docket(DocumentationType.SWAGGER_2)
                .groupName("")
                .genericModelSubstitutes(new Class<?>[] { DeferredResult.class } )
                .useDefaultResponseMessages(false)
                .forCodeGeneration(false)
                .pathMapping("/")
                .select()
                .apis(RequestHandlerSelectors.basePackage("cn.com.captureNetPacket"))
                .build()
                .apiInfo(sceneMgrApiInfo());
    }

    private ApiInfo sceneMgrApiInfo() {
        return (new ApiInfoBuilder()).title("EGOO_CAPTURENETPACKETCONFIG").description("CAPTURE_NET_PACKET_CONFIG").version("1.0.0").build();
    }

}
